public class LinkedList {
 
	 public Node start;
	 
	 public LinkedList() {
		 start = null;
	 }
	 
	 public void insert(int x) {
		  if(start == null) {
			  start = new Node(x, start);
		  } else {  
			  Node temp = start;
		   
			  while(temp.getNext() != null) {
				  temp = temp.getNext();
			  }
			  Node newNode = new Node(x,null);
			  temp.setNext(newNode);
		  }
	 }
	 
	 
	 public void delete(int x) {
		  Node previous =  start;
		  Node temp = start;
		  
		  while(temp.getData() != x) {
			   if(temp.getNext() == null) {
			    System.out.println("\nElement "+ x + " not found !");
			    break;
		   }
		   
		   previous = temp;
		   temp = temp.getNext();
		 
		  }
		  if(temp == start) {
			  start = start.getNext();
		  } else {
			  previous.setNext(temp.getNext()); //fixed bug to correctly connect nodes on either side of deleted node
		  }
	}
	 
	 
}